package com.blog.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 *
 * </p>
 *
 * @author huangzp
 * @since 2021-12-13
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class BlogArticle implements Serializable {

    private static final long serialVersionUID=1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 文章封面
     */
    @TableField("articleHeadPic")
    private String articleHeadPic;

    /**
     * 文章名称
     */
    @TableField("articleName")
    private String articleName;

    /**
     * 文章标签
     */
    @TableField("articleTag")
    private String articleTag;

    /**
     * 文章简介
     */
    @TableField("articleRemark")
    private String articleRemark;

    /**
     * 文章阅读量
     */
    @TableField("articleReadCount")
    private Integer articleReadCount;

    /**
     * 文章状态
     */
    @TableField("articleState")
    private Integer articleState;

    @TableField("managerId")
    private Integer managerId;

    /**
     * 作者名称
     */
    @TableField("managerName")
    private String managerName;

    /**
     * 文章内容
     */
    @TableField("articleContent")
    private String articleContent;

    /**
     * 创建时间
     */
    @TableField("createTime")
    private String createTime;

    /**
     * 文章类型
     */
    @TableField("articleType")
    private Integer articleType;

    /**
     * 文章点赞数
     */
    @TableField("articleStarNum")
    private Integer articleStarNum;

    /**
     * 文章评论数
     */
    @TableField("articleConNum")
    private Integer articleConNum;

    private String enclosure;

    /**
     * 最新
     */
    @TableField(exist=false)
    private boolean latest;
    /**
     * 点赞
     */
    @TableField(exist=false)
    private boolean favorite;
    /**
     * 评论
     */
    @TableField(exist=false)
    private boolean commentMost;
    /**
     * 阅读量
     */
    @TableField(exist=false)
    private boolean recommend;
    public String[] getTags(){
        if (articleTag != null){
            String[] split = articleTag.split(",");
            return  split;
        }
        return null;
    }
}
